import { ElNotification, ElMessage,ElMessageBox } from 'element-plus'

// 普通信息提示
export function info(msg){
  ElMessage({
    type: 'info',
    showClose: true,
    dangerouslyUseHTMLString: true,
    message: msg,
  })
}

// 成功提示
export function success(msg){
  ElMessage({
    type: 'success',
    // showClose: true,
    dangerouslyUseHTMLString: true,
    message: msg,
  })
}

// 错误提示
export function error(msg){
  ElMessage({
    type: 'error',
    // showClose: true,
    dangerouslyUseHTMLString: true,
    message: msg,
  })
}

// 警告提示
export function warning(msg){
  ElMessage({
    type: 'warning',
    // showClose: true,
    dangerouslyUseHTMLString: true,
    message: msg,
  })
}

// 带一个确定按钮或是按钮的alertBox
export function alert(msg,btnName,type) {
  let confirmName = btnName == '确定'? '确定' : '是'
  return ElMessageBox.alert(msg, '提示',{
    type: type??'info',
    confirmButtonText: confirmName,
    dangerouslyUseHTMLString: true
  })
}

// 带确定取消按钮或者是否按钮的弹出提示框
export function confirm(msg,fName?,cName?,type?) {
  let confirmName = fName?fName:'确定'
  let cancelsName = cName?cName:'取消'
  return ElMessageBox.confirm(msg,'提示', {
    type: type??'warning',
    confirmButtonText: confirmName,
    cancelButtonText: cancelsName,
    closeOnClickModal: false,
    closeOnPressEscape: false,
    dangerouslyUseHTMLString: true
  })
}